<template>
    <view class="conbox">
        <view class="bgbox">
            <view class="bgimg">
                <image src="/static/me/banner.jpg" mode="widthFix"></image>
            </view>
        </view>
        <view class="personinfobox">
            <view class="personinfo">
                <view class="avatar">
                    <view v-if="flag" @click="goLogin">去登录</view>
                    <image :src="userDatas.recruitVo.userHeaderImage" mode="widthFix"></image>
                </view>
                <view class="info">
                    <view class="nickname">
                        {{userDatas.recruitVo.userNickname}}
                        <image :src="sexIconSrc[userDatas.recruitVo.userSex]" mode="widthFix"></image>
                    </view>
                    <view class="tel_box">
                        <text class="tel">
                            {{userDatas.recruitVo.userPhone}}
                        </text>
                        <text class="passc_ertify" :class="{certify:userDatas.authenticationStatu==='未认证'}">{{userDatas.authenticationStatu}}</text>
                    </view>
                </view>
                <view class="editinfo" @click="goEditInfo">
                    编辑资料
                    <view class="gt">
                        <image src="/static/icon/img_icon26.png@2x.png" mode="widthFix"></image>
                    </view>
                </view>
            </view>
            <view class="introduce">
                {{userDatas.recruitVo.userDescribe}}
            </view>
            <view class="otherinfobox">
                <view class="otherinfo" @click="goAttention(userDatas.recruitVo.userId)">
                    <text class="num">{{userDatas.likeNum}}</text>
                    关注
                </view>
                <view class="otherinfo" @click="goMyFans(userDatas.recruitVo.userId)">
                    <text class="num">{{userDatas.fansNum}}</text>
                    粉丝
                </view>

                <view class="otherinfo" @click="goMyCollection">
                    <text class="num">{{userDatas.collectionNum}}</text>
                    收藏
                </view>
            </view>
        </view>
        <view class="goto">
            <view class="historyinfo" @click="goHistoryInfo">
                <image src="/static/icon/img_icon21.png@2x.png" mode="widthFix"></image>
                历史信息
                <view class="gt">
                    <image src="/static/icon/img_icon26.png@2x.png" mode="widthFix"></image>
                </view>
            </view>
            <view class="ticketinfo" @click="goTicketInfo">
                <image src="/static/icon/img_icon22.png@2x.png" mode="widthFix"></image>
                购票信息
                <view class="gt">
                    <image src="/static/icon/img_icon26.png@2x.png" mode="widthFix"></image>
                </view>
            </view>
            <view class="mycontribution" @click="goContribute">
                <image src="/static/icon/img_icon23.png@2x.png" mode="widthFix"></image>
                我的投稿
                <view class="gt">
                    <image src="/static/icon/img_icon26.png@2x.png" mode="widthFix"></image>
                </view>
            </view>
            <view class="myrecruit" @click="goRecruit">
                <image src="/static/icon/img_icon24.png@2x.png" mode="widthFix"></image>
                我的招募
                <view class="gt">
                    <image src="/static/icon/img_icon26.png@2x.png" mode="widthFix"></image>
                </view>
            </view>
        </view>
        <view class="myset" @click="goSet">
            <image src="/static/icon/img_icon25.png@2x.png" mode="widthFix"></image>
            设置
            <view class="gt">
                <image src="/static/icon/img_icon26.png@2x.png" mode="widthFix"></image>
            </view>
        </view>

    </view>
</template>

<script>
    export default {
        components: {

        },
        data() {
            return {
                //是否登录
                flag: true,
                userDatas: {
                    recruitVo: {
                        userHeaderImage: '',
                        userNickname: '',
                        userDescribe: '',
                        userPhone: '',
                        userSex: '',
                        userId: ''
                    }
                },
                sexIconSrc: {
                    "男": "/static/icon/img_icon19.png@2x.png",
                    "女": "/static/icon/img_icon20.png@2x.png"
                },
                isAertify: false
            };
        },
        methods: {
            goLogin() {
                uni.navigateTo({
                    url: '/pages/components/login/login'
                });
            },
            goEditInfo() {
                uni.navigateTo({
                    url: '/components/me/editinfo'
                });
            },
            goTicketInfo() {
                uni.navigateTo({
                    url: '/components/me/ticketinfo'
                });
            },
            goMyFans(id) {
                uni.navigateTo({
                    url: '/components/me/myfans?myId=' + id
                });
            },
            goAttention(id) {
                uni.navigateTo({
                    url: '/components/me/myattention?myId=' + id
                });
            },
            goSet() {
                uni.navigateTo({
                    url: '/components/me/set'
                });
            },
            goMyCollection() {
                uni.navigateTo({
                    url: '/components/me/mycollection'
                });
            },
            goRecruit() {
                uni.navigateTo({
                    url: '/components/me/myrecruit'
                });
            },
            goContribute() {
                uni.navigateTo({
                    url: '/components/me/mycontribute'
                });
            },
            goHistoryInfo() {
                uni.navigateTo({
                    url: '/components/me/historyinfo'
                });
            },
            //请求个人数据
            getPersonData() {
                const token = uni.getStorageSync('token');
                this.$request('/comic-time/personal/viewMyProfile', {}, 'GET', {
                    'Authorization': token
                }).then(res => {
                    console.log(res)
                    this.userDatas = res.data
                    console.log(this.userDatas)
                });
            }
        },
        onShow() {
            const token = uni.getStorageSync('token');
            if (token) {
                this.flag = false
                this.getPersonData();
            } else {
                this.flag = true
                this.userDatas = {
                    recruitVo: {
                        userHeaderImage: '',
                        userNickname: '',
                        userDescribe: '',
                        userPhone: '',
                        userSex: '',
                        userId: ''
                    }
                }
            }
        }
    }
</script>

<style lang="scss" scoped>
    .conbox {
        width: 100%;
        height: calc(100vh - 80rpx);
        background-color: #F5F5F5;
        position: relative;


        .bgbox {
            width: 750rpx;
            height: 500rpx;
            // background-color: #dcdcdc;
            background-color: #ffffff;
            border-radius: 0rpx 0rpx 10rpx 10rpx;

            .bgimg {
                width: 750rpx;
                height: 300rpx;
                background-color: #61dcca;

                image {
                    width: 750rpx;
                }
            }
        }

        .personinfobox {
            position: absolute;
            top: 142rpx;
            left: 77rpx;
            width: 600rpx;
            height: 319rpx;
            background-color: #ffffff;
            box-shadow: 0rpx 2rpx 24rpx 0rpx rgba(0, 0, 0, 0.1);
            border-radius: 10rpx;

            .personinfo {
                height: 155rpx;
                width: 600rpx;
                // background-color: #ffffff;
                // position: absolute;
                // vertical-align: middle;

                .avatar {
                    width: 100rpx;
                    height: 100rpx;
                    background-color: #ffffff;
                    border: solid 1rpx #eeeeee;
                    border-radius: 50%;
                    position: absolute;
                    overflow: hidden;
                    top: 35rpx;
                    left: 20rpx;

                    view {
                        width: 100rpx;
                        height: 100rpx;
                        line-height: 100rpx;
                        text-align: center;
                    }

                    image {
                        width: 100rpx;

                    }
                }

                .info {
                    width: 184rpx;
                    height: 70rpx;
                    position: absolute;
                    top: 58rpx;
                    left: 143rpx;

                    .nickname {
                        width: 300rpx;
                        height: 40rpx;
                        font-family: PingFangSC-Medium;
                        font-size: 32rpx;
                        line-height: 40rpx;
                        color: #000000;
                        display: flex;

                        image {
                            width: 31rpx;
                            height: 31rpx;
                            margin-left: 10rpx;
                        }
                    }



                    .tel_box {
                        width: 244rpx;
                        height: 30rpx;
                        font-family: PingFangSC-Regular;
                        font-size: 24rpx;
                        line-height: 30rpx;
                        color: #999999;
                        display: flex;

                        .tel {
                            margin-right: 10rpx;
                        }

                        .passc_ertify {
                            font-family: PingFangSC-Medium;
                            font-size: 22rpx;
                            line-height: 30rpx;
                            color: #666666;

                        }
                    }
                }

                .editinfo {
                    width: 120rpx;
                    height: 30rpx;
                    font-family: PingFangSC-Light;
                    font-size: 24rpx;
                    line-height: 30rpx;
                    color: #000000;
                    position: absolute;
                    top: 76rpx;
                    left: 450rpx;
                    display: flex;

                    .gt {
                        width: 11rpx;
                        height: 20rpx;
                        margin-left: 10rpx;

                        image {
                            width: 11rpx;
                        }
                    }
                }
            }

            .introduce {
                width: 100%;
                height: 26rpx;
                font-family: PingFangSC-Regular;
                font-size: 20rpx;
                line-height: 21rpx;
                color: #666666;
                box-sizing: border-box;
                padding-left: 32rpx;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .otherinfobox {
                width: 100%;
                height: 138rpx;
                display: flex;
                justify-content: space-around;
                align-items: center;

                .otherinfo {

                    height: 58rpx;
                    font-family: PingFangSC-Regular;
                    font-size: 24rpx;
                    line-height: 36rpx;
                    color: #666666;

                    .num {
                        display: block;
                        font-family: PingFangSC-Regular;
                        font-size: 36rpx;
                        line-height: 36rpx;
                        color: #000000;
                        text-align: center;
                    }
                }
            }

        }

        .goto {
            width: 100%;
            height: 400rpx;
            margin-top: 10rpx;
            margin-bottom: 10rpx;
            border-radius: 10rpx;

            .historyinfo,
            .ticketinfo,
            .mycontribution,
            .myrecruit {
                width: 750rpx;
                height: 100rpx;
                background-color: #fff;
                border-bottom: solid 1rpx #eeeeee;
                font-family: PingFangSC-Regular;
                font-size: 28rpx;
                // line-height: 100rpx;
                color: #000000;
                box-sizing: border-box;
                display: flex;
                align-items: center;
                padding-left: 64rpx;

                border-radius: 10rpx;

                image {
                    width: 50rpx;
                    height: 50rpx;
                    margin-right: 30rpx;
                }


                .gt {
                    width: 11rpx;
                    padding-left: 400rpx;

                    image {
                        width: 11rpx;
                    }
                }
            }
        }

        .myset {
            width: 750rpx;
            height: 100rpx;
            background-color: #fff;
            border-bottom: solid 1rpx #eeeeee;
            font-family: PingFangSC-Regular;
            font-size: 28rpx;
            color: #000000;
            box-sizing: border-box;
            padding-left: 65rpx;
            border-radius: 10rpx;
            display: flex;
            align-items: center;

            image {
                font-size: 28rpx;
                width: 50rpx;
                margin-right: 30rpx;

            }

            .gt {
                width: 11rpx;
                padding-left: 453rpx;

                image {
                    width: 11rpx;
                }
            }
        }

    }

    .certify {
        color: #ff6262 !important;
        text-decoration: underline;
    }
</style>
